﻿using ZyGame.Game;
using ZyGame.Transport;

namespace ZyGame
{
    public static class WorldExtension
    {
        public static Entity NewEntity(this World world, params EntityComponent[] components) => EntityManager.instance.CreateEntity(world, 0, components);

        public static Entity NewEntity(this World world, int guid, params EntityComponent[] components) => EntityManager.instance.CreateEntity(world, guid, components);

        public static Entity GetEntity(this World world, int guid) => EntityManager.instance.GetEntity(world.GetType().Name, guid);

        public static Entity[] GetEntities(this World world) => EntityManager.instance.GetEntities(world.GetType().Name);

        public static void RemoveEntity(this World world, int guid) => EntityManager.instance.ReleaseEntity(world.GetType().Name, guid);

        public static T[] GetComponents<T>(this World world) where T : EntityComponent => EntityManager.instance.GetComponents<T>(world);
    }
}